package org.jeecg.modules.middle.datas.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.manage.entity.CaishuiRecharge;

import java.util.List;
import java.util.Map;

/**
 * @Description: 账户充值
 * @Author: yfkj
 * @Date:   2023-02-22
 * @Version: V1.0
 */
public interface CaishuiRechargeMapper extends BaseMapper<CaishuiRecharge> {

    /**
     * 查询充值总额
     * @param params
     * @return
     */
    public Map<String,Object> queryTotalAmount(@Param("params") Map<String, String> params);

    /**
     * 最近7天充值统计
     * @return
     */
    public List<Map<String,Object>> last7DaysRechargeSum(@Param("params") Map<String, String> params);

    /**
     * 最近30天充值统计
     * @return
     */
    public List<Map<String,Object>> last30DaysRechargeSum(@Param("params") Map<String, String> params);

    /**
     * 分组查询充值记录的付款信息(下拉列表)
     * @param params
     * @return
     */
    @Select("SELECT s.payment_account AS value,s.payment_account_name AS label FROM caishui_recharge s WHERE s.`status` = 1 AND s.check_status = 1 " +
            "AND s.company_id = #{params.companyId} AND s.business_id = #{params.businessId} GROUP BY s.payment_account")
    public List<Map<String,Object>> queryRechargePayInfo(@Param("params") Map<String, String> params);

}
